package com.vii.brillien.services.sso.ldap;

import com.vii.brillien.core.component.sso.SubjectPresence;
import com.vii.brillien.kernel.BrillienException;
import com.vii.brillien.kernel.annotations.PresenceService;
import com.vii.brillien.kernel.annotations.lifecycle.Resident;
import com.vii.brillien.kernel.axiom.sso.Session;

import java.util.List;

/**
 * Reference implementation for a specialized SubjectPresence managing an LDAP provider
 */
@PresenceService
@Resident
public class LdapPresence<R> extends SubjectPresence<R> {

    /*
    Hashtable env = new Hashtable();

        env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
        env.put(Context.PROVIDER_URL, "ldap://zanzibar:10389/o=sevenSeas");

        env.put(Context.SECURITY_PRINCIPAL, "uid=admin,ou=system");
        env.put(Context.SECURITY_CREDENTIALS, "secret");
        env.put(Context.SECURITY_AUTHENTICATION, "simple");

        InitialDirContext ctx = new InitialDirContext(env);

        Attributes attrs = ctx.getAttributes("");
        NamingEnumeration enm = attrs.getAll();
        while (enm.hasMore()) {
            System.out.println(enm.next());
        }
    * */

    @Override
    protected void initiate() throws BrillienException {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    protected Session innerAuthenticate(String username, String principal) throws BrillienException {
        return null;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    protected void innerLogout(Session session) throws BrillienException {
        //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    protected boolean innerIsAuthenticated(Session session) throws BrillienException {
        return false;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    protected boolean innerHasRole(Session session, String roleIdentifier) throws BrillienException {
        return false;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    protected boolean innerHasARole(Session session, List<String> roleIdentifiers) throws BrillienException {
        return false;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    protected boolean innerHasRoles(Session session, List<String> roleIdentifiers) throws BrillienException {
        return false;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    protected boolean innerHasPermission(Session session, String permission) throws BrillienException {
        return false;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    protected boolean innerHasAPermission(Session session, List<String> permissions) throws BrillienException {
        return false;  //To change body of implemented methods use File | Settings | File Templates.
    }

    @Override
    protected boolean innerHasPermissions(Session session, List<String> permissions) throws BrillienException {
        return false;  //To change body of implemented methods use File | Settings | File Templates.
    }

}
